/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.querie.test;

import com.querie.collab.CosineItemSimilarity;
import com.querie.collab.ItemSimilarity;
import com.querie.collab.JacItemSimilarity;
import com.querie.util.QryParameters;

/**
 *
 * @author Duc On <ductuanon@hotmail.com>
 */
public class ThreadTrain extends Thread {

    public void run() {

        try {
            ItemSimilarity sim = null;
            QryParameters qParam = QryParameters.getInstance();
            String trainString = qParam.getValue("TRAINSESSION");
            String whereClause = " where sessionId in (" + trainString + ")";
            String algoType = qParam.getValue("ALGO");
            if (algoType.equals("jac")) {
                sim = new JacItemSimilarity();
            } else if (algoType.equals("cos")) {
                sim = new CosineItemSimilarity();
            } else {
                throw new Exception("Unknown Algorithm");
            }
            sim.processBackendForAllSessions(whereClause);
            //new TestHarnessButtonStatus().enableAllButtons();
            //QryParameters.getInstance().enableAllButtons();
        } catch(Exception ex) {
            ex.printStackTrace();
        }
    }
}
